package constant

// PageSize 默认分类数量
const PageSize = 10

const (
	SUCCESS       = 1
	ERROR         = 0
	InvalidParams = 400
	UNAUTHORIZED  = 401

	ErrorEditUserFail            = 10101
	ErrorNotExistUser            = 10102
	ErrorGetUserFail             = 10103
	ErrorGetAllUserFail          = 10104
	ErrorCleanSoftDeleteUserFail = 10105
	ErrorAddUserFail             = 10106
	ErrorDeleteUserFail          = 10107
	ErrorCheckExistUserFail      = 10108
	ErrorCountUserFail           = 10109
	ErrorCheckPasswordFail       = 10110
	ErrorUserNameOrPassword      = 10111
	ErrorExistUserName           = 10112
	ErrorResetPasswordFail       = 10113
	ErrorPasswordSize            = 10114

	ErrorNotExistApi       = 10202
	ErrorGetApiFail        = 10203
	ErrorGetAllApiFail     = 10204
	ErrorCheckExistApiFail = 10208
	ErrorCountApiFail      = 10209

	ErrorRepeatLucky      = 10310
	ErrorDayNotLuckyCount = 10311

	ErrorCheckTokenFail  = 10401
	ErrorTokenTimeout    = 10402
	ErrorToken           = 10403
	ErrorCreateTokenFail = 10404
	ErrorParseTokenFail  = 10405

	ErrorUploadSaveImageFail    = 10501
	ErrorUploadCheckImageFail   = 10502
	ErrorUploadCheckImageFormat = 10503

	ErrorGetCaptchaFail = 10601
	ErrorCaptcha        = 10602

	ErrorGetRoleFail = 10701
)

var ErrText = map[int]string{
	SUCCESS:       "ok",
	ERROR:         "fail",
	InvalidParams: "请求参数错误",
	UNAUTHORIZED:  "没有访问权限",

	ErrorEditUserFail:            "编辑用户失败",
	ErrorNotExistUser:            "用户不存在",
	ErrorGetUserFail:             "获取用户失败",
	ErrorGetAllUserFail:          "获取所有用户失败",
	ErrorCleanSoftDeleteUserFail: "清空所有软删除用户失败",
	ErrorAddUserFail:             "添加用户失败",
	ErrorDeleteUserFail:          "删除用户失败",
	ErrorCheckExistUserFail:      "验证已存在用户失败",
	ErrorCountUserFail:           "统计用户数量失败",
	ErrorCheckPasswordFail:       "验证密码失败",
	ErrorUserNameOrPassword:      "用户名或者密码错误",
	ErrorExistUserName:           "用户名已存在",
	ErrorResetPasswordFail:       "修改密码失败",
	ErrorPasswordSize:            "密码长度不能小于6位",

	ErrorNotExistApi:       "不存在",
	ErrorGetApiFail:        "获取失败",
	ErrorGetAllApiFail:     "获取所有失败",
	ErrorCheckExistApiFail: "验证已存在失败",
	ErrorCountApiFail:      "统计数量失败",

	ErrorRepeatLucky:      "正在抽奖，请稍后重试",
	ErrorDayNotLuckyCount: "今日抽奖次数已用完",

	ErrorCheckTokenFail:  "Token鉴权失败",
	ErrorTokenTimeout:    "Token已超时",
	ErrorCreateTokenFail: "Token生成失败",
	ErrorToken:           "Token错误",
	ErrorParseTokenFail:  "Token解析失败",

	ErrorUploadSaveImageFail:    "保存图片失败",
	ErrorUploadCheckImageFail:   "检查图片失败",
	ErrorUploadCheckImageFormat: "校验图片错误，图片格式或大小有问题",

	ErrorGetCaptchaFail: "生成验证码失败",
	ErrorCaptcha:        "验证码错误",

	ErrorGetRoleFail: "获取角色信息失败",
}

// GetErrText returns a text for the error. It returns the empty
func GetErrText(code int) string {
	return ErrText[code]
}
